PROJECT (TIME_PASS)
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
SET(CMAKE_BUILD_TYPE DEBUG)

#must add "-lrt" flag to reference "shm_open" and "unlink"
SET(CMAKE_EXE_LINKER_FLAGS "-lrt -pthread")

GET_FILENAME_COMPONENT(TIME_PASS_BASE ".." REALPATH)
#SET(CMAKE_INSTALL_PREFIX  ${TIME_PASS_BASE})
#SET (EXECUTABLE_OUTPUT_PATH ${TIME_PASS_BASE}/example/bin)

INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)

FIND_LIBRARY(GLOBAL NAMES TimepassGlobal PATHS ${CMAKE_INSTALL_PREFIX}/lib)
FIND_LIBRARY(LOCK NAMES TimepassLock PATHS ${CMAKE_INSTALL_PREFIX}/lib)
#FIND_LIBRARY(MODEL NAMES TimepassModel PATHS ${CMAKE_INSTALL_PREFIX}/lib)
FIND_LIBRARY(SHM NAMES TimepassShm PATHS ${CMAKE_INSTALL_PREFIX}/lib)
FIND_LIBRARY(SOCK NAMES TimepassSock PATHS ${CMAKE_INSTALL_PREFIX}/lib)
FIND_LIBRARY(SYS NAMES TimepassSys PATHS ${CMAKE_INSTALL_PREFIX}/lib)
FIND_LIBRARY(TIME NAMES TimepassTime PATHS ${CMAKE_INSTALL_PREFIX}/lib)

ADD_SUBDIRECTORY(daytimetcpcli)
ADD_SUBDIRECTORY(daytimetcpsrv)
ADD_SUBDIRECTORY(echocli)
ADD_SUBDIRECTORY(echosvr)
ADD_SUBDIRECTORY(filelock)
ADD_SUBDIRECTORY(mutex_consume)
ADD_SUBDIRECTORY(mutex_multiconsume)
ADD_SUBDIRECTORY(rwlock)
ADD_SUBDIRECTORY(rwmutex)
ADD_SUBDIRECTORY(rwsem)
ADD_SUBDIRECTORY(sem_consume)
ADD_SUBDIRECTORY(sem_multibuff)
ADD_SUBDIRECTORY(sem_multiconsume)
ADD_SUBDIRECTORY(shm_array)
ADD_SUBDIRECTORY(shm_doublylist)
ADD_SUBDIRECTORY(shm_hashlist)
ADD_SUBDIRECTORY(shm_list)
ADD_SUBDIRECTORY(shm_map)
ADD_SUBDIRECTORY(shm_multihashmap)
ADD_SUBDIRECTORY(shm_multihashset)
ADD_SUBDIRECTORY(shm_multimap)
ADD_SUBDIRECTORY(shm_queue)
ADD_SUBDIRECTORY(shm_set)
ADD_SUBDIRECTORY(shm_tuplelist)
ADD_SUBDIRECTORY(st_echosvr)
ADD_SUBDIRECTORY(tcpudpsz)
ADD_SUBDIRECTORY(timer)
